//
//  MyView.m
//  lehuotest
//
//  Created by ice on 2016/12/28.
//  Copyright © 2016年 QF. All rights reserved.
//

#import "LHDetailHeaderView.h"

@implementation LHDetailHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(id) initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self){
        self.clipsToBounds = YES;
        UIImageView *vv = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
        vv.backgroundColor = [UIColor redColor];
        vv.image = [UIImage imageNamed:@"icon_child_01"];
        [self addSubview:vv];
        
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.backgroundColor = [UIColor greenColor];
        btn.frame = CGRectMake(100, frame.size.height-50, 100, 30);
        [self addSubview:btn];
        [btn addTarget:self action:@selector(btnAction) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return self;
}


-(void) btnAction
{
    if (self.btnBlock){
        self.btnBlock();
    }
}

-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
    UIView *result = [super hitTest:point withEvent:event];
    if (result == self) {
        return nil;
    } else {
        return result;
    }
}

-(void) dealloc
{
    self.btnBlock = nil;
}
@end
